#ifndef MESSAGEHANDLER_H
#define MESSAGEHANDLER_H

#include "protocol.h"
#include "connection.h"
#include <sstream>

namespace client_server{
	class MessageHandler{
	public:
		MessageHandler();
		void read(Connection* goal, std::stringstream& ss);		//Read and return message from connection
		void sendIntParameter(Connection* goal, int value);
		void sendStringParameter(Connection* goal, std::string s);
		void sendByte(Connection* goal, char code);
	private:
		void readParameters(Connection* goal, std::stringstream& ss);
		void readError(Connection* goal, std::stringstream& ss);
		void sendInt(Connection* goal, int value);
	};
	
}
#endif
